#include <stdio.h>

int d(int k)
{
    int n = k;
    while (k)
    {
        n += k % 10;
        k /= 10;
    }
    return n;
}

int main()
{
    unsigned char visited[10000] = { 0 };
    int i, j;
    for (i = 1; i < 10000; i++)
    {
        if (visited[i])
            continue;
        printf("%d\n", i);
        for (j = i; j < 10000; j = d(j))
            visited[j] = 1;
    }
    return 0;
}